package com.qf.shoppingorder.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.qf.shoppingorder.entity.Order;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;

import java.util.List;

@Mapper
public interface OrderMapper extends BaseMapper<Order> {
//    @Select("SELECT * FROM product WHERE product_id IN (${productIds}) and user_id=#{userId}")
    List<Order> getAllByUser(Integer userId);

    @Insert("INSERT INTO orders (`order_number`, `product_id`, `user_id`, `address`, `status`, `create_time`, `pay_time`, `expiration_time`, `brand`, `product_quantity`, `amount`) " +
            "VALUES (#{orderNumber}, #{productId}, #{userId}, #{address}, #{status}, #{createTime}, #{payTime}, #{expirationTime}, #{brand}, #{productQuantity}, #{amount})")
    int insertOrder(Order order);
}
